//
//  PushChannelTableViewCell.m
//  Movie
//
//  Created by cjy on 16/3/26.
//  Copyright © 2016年 HY. All rights reserved.
//

#import "PushChannelTableViewCell.h"
#import "ChannelModel.h"
#import <UIImageView+WebCache.h>
@implementation PushChannelTableViewCell

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{

    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    
    if (self) {
    
        self.imageV = [[UIImageView alloc]init];
        [self.contentView addSubview:self.imageV];
        
        self.title = [[UILabel alloc]init];
        [self.contentView addSubview:self.title];
        
        self.artistName = [[UILabel alloc]init];
        [self.contentView addSubview:self.artistName];
        
        self.totalViews = [[UILabel alloc]init];
        [self.contentView addSubview:self.totalViews];
    }

    return self;
}


- (void)layoutSubviews{

    [super layoutSubviews];
    
    self.imageV.frame = CGRectMake(0, 0, self.contentView.frame.size.width / 3 +30, 100);

    self.title.frame = CGRectMake(self.contentView.frame.size.width / 3 + 40, 10,self.contentView.frame.size.width / 2, 20);
    self.title.font = [UIFont systemFontOfSize:12];
    
    self.artistName.frame = CGRectMake(self.contentView.frame.size.width / 3 + 40, 35, self.contentView.frame.size.width / 2, 20);
    
    self.artistName.font = [UIFont systemFontOfSize:12];
    self.artistName.textColor = [UIColor colorWithRed:63 / 255.f green:186 / 255.f blue:149 /255.f alpha:1];
    
    self.totalViews.frame = CGRectMake(self.contentView.frame.size.width / 3 + 40, 60, self.contentView.frame.size.width / 2, 20);
    self.totalViews.font = [UIFont systemFontOfSize:12];
    self.totalViews.textColor = [UIColor grayColor];

}

- (void)passModel:(ChannelModel *)model{

    [self.imageV sd_setImageWithURL:[NSURL URLWithString:model.posterPic] placeholderImage:[UIImage imageNamed:@"zwt"]];
    self.title.text = model.title;
    self.artistName.text = model.artistsName;
    self.totalViews.text = [NSString stringWithFormat:@"播放次数:%@",model.totalViews];
}


- (void)awakeFromNib {
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
